package com.inno.thread.hello;

public class RunableDemo implements Runnable {

    private Thread thread;
    private String threadName;

    public RunableDemo(String threadName) {
        this.threadName = threadName;
    }

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + "正在执行" + "-状态" + Thread.currentThread().getState().name());
    }

    public void start() {
        if (thread == null) {
            thread = new Thread(this, threadName);
        }
        thread.start();
    }

    public static void main(String[] args) {
        for (int i = 0; i < 100; i++) {
            new RunableDemo("thread" + i).start();
        }
    }
}
